"""
Copyright (c) 2023 - present SKbioinfo
"""

from apps.NGS_API.connect import MysqlConnection
from apps.NGS_API.common.db_table_config import *

def get_bioana_info():
    ### set up MYSQL connection ###
    db_conn=MysqlConnection()
    ### SQL: bioana_base_info ###
    cols = '''
        analysis_id,
        analysis_id,
        n_sample,
        operate_user,
        check_user,
        status,
        pipeline,
        commit_hash,
        operate_start_time,
        operate_end_time,
        extra_argument,
        create_time,
        modify_time,
        argument_template,
        id
    '''
    bioana_base_info_sql='''
    SELECT 
        {cols}
    FROM {table_name}
    ORDER BY operate_end_time DESC
    '''.format(
        cols = cols,
        table_name = bioana_db["name"]
    )
    bioana_base_info = db_conn.Query(bioana_base_info_sql)
    db_conn.close_conn()
    return bioana_base_info